home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1998 June / SGI Freeware 1998 June.iso / dist / fw_NCDnas.idb / usr / freeware / include / audio / aiff.h.z / aiff.h
C/C++ Source or Header  |  1998-01-21  |  4KB  |  176 lines

  1. /*
  2.  * Copyright 1993 Network Computing Devices, Inc.
  3.  * 
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided that
  6.  * the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name Network Computing Devices, Inc. not be
  9.  * used in advertising or publicity pertaining to distribution of this
  10.  * software without specific, written prior permission.
  11.  * 
  12.  * THIS SOFTWARE IS PROVIDED 'AS-IS'.  NETWORK COMPUTING DEVICES, INC.,
  13.  * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
  14.  * LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  15.  * PARTICULAR PURPOSE, OR NONINFRINGEMENT.  IN NO EVENT SHALL NETWORK
  16.  * COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
  17.  * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
  18.  * OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
  19.  * WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
  20.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  * 
  22.  * $NCDId: @(#)aiff.h,v 1.4 1995/05/23 23:36:26 greg Exp $
  23.  */
  24.  
  25. #ifndef _AIFF_H_
  26. #define _AIFF_H_
  27.  
  28. #include <audio/audio.h>    /* for AuInt32 and AuUint32 */
  29.  
  30. /*
  31.  * If we are being used outside the NCD-AUDIO sound library, then we'll need
  32.  * some ANSIfication definitions.
  33.  */
  34.  
  35. #ifndef NeedFunctionPrototypes
  36. #if defined(FUNCPROTO) || __STDC__ || defined(__cplusplus) || defined(c_plusplus)
  37. #define NeedFunctionPrototypes 1
  38. #else
  39. #define NeedFunctionPrototypes 0
  40. #endif
  41. #endif                        /* NeedFunctionPrototypes */
  42.  
  43. #ifndef _AiffConst
  44. #if __STDC__ || defined(__cplusplus) || defined(c_plusplus) || (FUNCPROTO&4)
  45. #define _AiffConst const
  46. #else
  47. #define _AiffConst                /**/
  48. #endif
  49. #endif                        /* _AiffConst */
  50.  
  51. #ifndef _FUNCPROTOBEGIN
  52. #ifdef __cplusplus            /* for C++ V2.0 */
  53. #define _FUNCPROTOBEGIN extern "C" {    /* do not leave open across includes */
  54. #define _FUNCPROTOEND }
  55. #else
  56. #define _FUNCPROTOBEGIN
  57. #define _FUNCPROTOEND
  58. #endif
  59. #endif /* _FUNCPROTOBEGIN */
  60.  
  61. #define AIFF_FormID            "FORM"
  62. #define AIFF_AiffID            "AIFF"
  63. #define AIFF_CommonID            "COMM"
  64. #define AIFF_SoundDataID        "SSND"
  65. #define AIFF_CommentID            "COMT"
  66.  
  67. #define AIFF_SizeofExtended        10
  68. #define AIFF_SizeofCommentChunk        10
  69. #define AIFF_SizeofCommonChunk        (8 + AIFF_SizeofExtended)
  70. #define AIFF_SizeofSoundDataChunk    8
  71.  
  72. typedef AuUint32 AIFF_ID;
  73. typedef short   AIFF_MARKER_ID;
  74.  
  75. typedef struct
  76. {
  77.     AIFF_ID         ckID;            /* chunk ID */
  78.     AuInt32            ckSize;            /* chunk data size, in bytes */
  79. }               AiffChunk;
  80.  
  81. typedef struct
  82. {
  83.     FILE           *fp;
  84.     char           *comment;
  85.     short           channels,
  86.                     bitsPerSample;
  87.     AuInt32            sampleRate;
  88.     AuUint32   dataOffset,
  89.                     numSamples;
  90.  
  91.     /* private data */
  92.     AuUint32   fileSize,
  93.                     dataSize,
  94.                     sizeOffset;
  95.     unsigned int    writing;
  96. }               AiffInfo;
  97.  
  98. /*****************************************************************************
  99.  *                   PUBLIC INTERFACES                 *
  100.  *****************************************************************************/
  101.  
  102. _FUNCPROTOBEGIN
  103.  
  104. extern AiffInfo *
  105. AiffOpenFileForReading(
  106. #if NeedFunctionPrototypes
  107.                _AiffConst char *    /* file name */
  108. #endif
  109. );
  110.  
  111. extern AiffInfo *
  112. AiffOpenFileForWriting(
  113. #if NeedFunctionPrototypes
  114.                _AiffConst char *,    /* file name */
  115.                AiffInfo *        /* info */
  116. #endif
  117. );
  118.  
  119. extern int
  120. AiffCloseFile(
  121. #if NeedFunctionPrototypes
  122.           AiffInfo *            /* info */
  123. #endif
  124. );
  125.  
  126. extern int
  127. AiffReadFile(
  128. #if NeedFunctionPrototypes
  129.          char *,                /* buffer */
  130.          int,                /* num bytes */
  131.          AiffInfo *                /* info */
  132. #endif
  133. );
  134.  
  135. extern int
  136. AiffWriteFile(
  137. #if NeedFunctionPrototypes
  138.           char *,                /* buffer */
  139.           int,                /* num bytes */
  140.           AiffInfo *            /* info */
  141. #endif
  142. );
  143.  
  144. extern int
  145. AiffSeekFile(
  146. #if NeedFunctionPrototypes
  147.           int,                              /* number of audio bytes */
  148.           AiffInfo *            /* info */
  149. #endif
  150. );
  151.  
  152. extern int
  153. AiffTellFile(
  154. #if NeedFunctionPrototypes
  155.           AiffInfo *            /* info */
  156. #endif
  157. );
  158.  
  159. extern int
  160. AiffFlushFile(
  161. #if NeedFunctionPrototypes
  162.           AiffInfo *            /* info */
  163. #endif
  164. );
  165.  
  166. extern int
  167. AiffRewindFile(
  168. #if NeedFunctionPrototypes
  169.            AiffInfo *            /* info */
  170. #endif
  171. );
  172.  
  173. _FUNCPROTOEND
  174.  
  175. #endif                        /* _AIFF_H_ */
  176.